package com.c.ctgproject.fragment.review.part

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.mode.MyConstants
import com.c.ctgproject.utils.awaitSync
import com.c.ctgproject.utils.handlerBody
import com.c.ctgproject.utils.launch
import com.c.ctgproject.utils.userToken

class RefusePartsViewModel : BaseViewModel() {
    private val mResult = MutableLiveData<String>()
    val result: LiveData<String> get() = mResult
    fun getList(page: Int, size: Int) {
        launch({
            mResult.value = ApiMethods.getApiService().reviewPartsList(userToken,
                handlerBody(
                    "isPass" to  MyConstants.REFUSE,
                    "pageNum" to page,
                    "pageSize" to size
                )
            ).awaitSync()
        }, {
            mError.value = it.message.toString()
        })
    }

}